<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Home extends CI_Controller {

    function __construct(){
        parent::__construct();
        $this->load->model('news/news_model');
    }

    public function index(){
        $this->load->model('pages/pages_model');
        $data['news']   = $this->news_model->order_by('create_date', 'desc')->limit(5)->get_many_by(array('active_flag' => ACTIVE_FLAG, 'delete_flag' => UNDELETE_FLAG, 'draft' => DRAFT_NO));
        $data['about']  = $this->pages_model->get_by(array('id' => 1));
        $data['tpl']    = 'home/index';
        $this->load->view('_layout/index', $data);
    }

    function err_404(){
        $data['tpl'] = 'home/err_404';
        $this->load->view('_layout/index', $data);
    }
}